package com.eqdd.yiqidian.ui.companyspace

import com.eqdd.yiqidian.bean.TeamMemberBean
import com.eqdd.yiqidian.bean.rebuild.slimedit.SlimEditEnterBean
import com.eqdd.yiqidian.bean.rebuild.slimedit.SlimEditHintBean
import com.eqdd.yiqidian.bean.rebuild.slimedit.SlimImageSelectBean
import com.eqdd.yiqidian.http.HttpConfig
import com.eqdd.yiqidian.ui.companyspace.base.BaseSpaceInfoActivity
import com.lzy.okgo.model.HttpParams

/**
 * Created by jhj on 18-6-26.
 */
class TeamMemberInfoActivity : BaseSpaceInfoActivity<TeamMemberBean>() {


    override val topbar: String
        get() = "个人信息"
    override val deleteUrl: String
        get() = HttpConfig.BASE_URL + HttpConfig.TEAM_MEMBER_DELETE
    override val updateImgUrl: String
        get() = HttpConfig.BASE_URL + HttpConfig.TEAM_MEMBER_IMAGE_UPDATE
    override val updateOtherUrl: String
        get() = HttpConfig.BASE_URL + HttpConfig.TEAM_MEMBER_UPDATE
    override val updateIdFieldName: String
        get() = "teamId"
    override val deleteIdFieldName: String
        get() = "teamId"


    override fun updateOtherParams(): HttpParams {
        val data = slimAdapterEx.data
        updateOtherParams.put("userName", data[1].content)
        updateOtherParams.put("PostMsg", data[2].content)
        updateOtherParams.put("Msg", data[3].content)
        return updateOtherParams
    }

    override fun setEditBeans() {
        datas.add(SlimImageSelectBean("头像", 0, bean?.headImage).setDeal(true).setNeed(true))
        if (type == 0) {
            datas.add(SlimEditEnterBean("姓名", bean?.userName, 1, "请输入").setNeed(true))
            datas.add(SlimEditEnterBean("职位", bean?.post, 2, "请输入").setNeed(true))
            datas.add(SlimEditEnterBean("简介", bean?.msg, 3, "请输入").setNeed(true))
        } else {
            datas.add(SlimEditHintBean("姓名", bean?.userName, 1).setNeed(true))
            datas.add(SlimEditHintBean("职位", bean?.post, 2).setNeed(true))
            datas.add(SlimEditHintBean("简介", bean?.msg, 3).setNeed(true))
        }

    }
}